home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_actor_floaterinf.cog < prev    next >
Text File  |  1999-11-15  |  3KB  |  133 lines

  1. # Jones 3D Cog Script
  2. #
  3. # actor_FloaterINF.cog
  4. #
  5. # Allows the Infernal Machine floater to do his thang...
  6. #
  7. # [MDR]
  8. #
  9. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13.  
  14.     message        startup
  15.     message        sighted
  16.     message        created
  17.     message        aievent
  18.     message        killed
  19.     message        callback
  20.  
  21. # ************************** TEMPLATES *************************
  22.     template    tpl_glow=+robotglow_sm    local
  23.     template    blast=+ExpFloaterSpr    local        # MDR: Used by explosion -- don't remove!
  24.  
  25. # *********************** MISC LOCAL VARS **********************
  26.     thing        t_sender                local
  27.     thing        t_glow                    local
  28.  
  29.     int            eventType                local
  30.     flex        f_userData                local
  31.     int            projectile                local
  32.     vector        vec_pos                    local
  33.  
  34.     int            FLAG_FIRE                local
  35.  
  36. end
  37.  
  38. # ========================================================================================
  39. code
  40.  
  41. # ........................................................................................
  42. startup:
  43.  
  44.     FLAG_FIRE        = 0x20;
  45.  
  46.     return;
  47.  
  48.  
  49. # ........................................................................................
  50. sighted:
  51.  
  52.     t_sender = GetSenderRef();
  53.     PlaySoundClass(t_sender, 1);                        # Play create sound
  54.  
  55.     return;
  56.  
  57.  
  58. # ........................................................................................
  59. created:
  60.  
  61.     t_sender = GetSenderRef();
  62.  
  63.     AISetMode(t_sender, 0x8000000);                        # Set MODE_ARMOREDSKIN
  64.     AISetMode(t_sender, 0x2000000);                        # Set MODE_NOCHASING
  65.  
  66.     vec_pos    = VectorAdd( GetThingPos(t_sender), '0 0 0.023' );
  67.     t_glow    = CreateThingAtPos(tpl_glow, FindNewSectorFromThing(t_sender, vec_pos), vec_pos, '0 0 0');
  68.     if ( t_glow > -1 )
  69.     {
  70.         AttachThingToThingEx(t_glow, t_sender, 0x08);
  71.     }
  72.  
  73.     SetThingUserData(t_sender, 0);
  74.  
  75.     return;
  76.  
  77.  
  78. # ........................................................................................
  79. aievent:
  80.  
  81.     t_sender    = GetSenderRef();
  82.     eventType    = GetParam(0);
  83.  
  84.     f_userData    = GetThingUserData(t_sender);
  85.  
  86.     if ( eventType == 0x4000 )                            #---- EVENT_FIRE
  87.     {
  88.         f_userData = BITSET(f_userData, FLAG_FIRE);            # Set "shot pending" flag
  89.     }
  90.  
  91.     SetThingUserData(t_sender, f_userData);                    # Record flag settings
  92.  
  93.     return;
  94.  
  95.  
  96. # ........................................................................................
  97. killed:
  98.  
  99.     t_sender    = GetSenderRef();
  100.  
  101.     t_glow = GetThingAttachedThing(t_sender, 13);
  102.     if ( t_glow > -1 )
  103.     {
  104.         DestroyThing(t_glow);
  105.     }
  106.  
  107.     return;
  108.  
  109.  
  110. # ........................................................................................
  111. callback:
  112.  
  113.     t_sender    = GetSenderRef();
  114.     f_userData    = GetThingUserData(t_sender);
  115.  
  116.     if ( BITTEST(f_userData, FLAG_FIRE) )
  117.     {
  118.         projectile = GetActorWeapon(t_sender);
  119.  
  120.         FireProjectile(t_sender, projectile, -1, -1, '0 0 0', '0 0 0', 1.0, 0, 0, 0);
  121.         f_userData = BITCLEAR(f_userData, FLAG_FIRE);                # Clear "shot pending" flag
  122.     }
  123.  
  124.     SetThingUserData(t_sender, f_userData);                        # Record flag settings
  125.  
  126.     return;
  127.  
  128. # ........................................................................................
  129.  
  130. end
  131.  
  132.  
  133.